<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script type="text/javascript">
    function showFormDiv(id,type){
        $("#leftListDiv").attr("class","main-content col-lg-8");
        $("#rightFormDiv").show('normal');
        return loadDiv('rigthCenterDiv','${ctx}/sys/sysOrgDict/bloodMatchForm?id='+id+'&type='+type);
    }
    function closeFormDiv(){
        $("#leftListDiv").attr("class","main-content col-lg-12");
        $("#rightFormDiv").hide();
    }

    function formDivSaveLoad(divId, formId, url, hrefUrl) {
        if ($('#' + formId).parsley().validate()) {
            setTimeout(formDivSaveMethod(divId, formId, url, hrefUrl), 300);
        }
        return false;
    }
    function formDivSaveMethod(divId, formId, url, hrefUrl) {
        if (flag) {
            flag = false;
            formSubmitInput(formId);
            $("#" + formId + " input,#" + formId + " select").removeAttr("disabled");
            $.ajax({
                type: "POST",
                data: $("#" + formId).serialize(),
                url: url,
                dataType: "json",
                success: function (data) {
                    if (data.code == "success") {
                        toastr.success(data.data);
                        loadDiv(divId,hrefUrl);
                    }
                    else {
                        flag = true;
                        toastr.error(data.data);
                    }
                },
                error: function (data) {
                    toastr.error('网络连接错误,请检查网络');
                    flag = true;
                }
            });
        }
        return false;
    }
</script>
<div class="app">
    <section class="layout">
        <section class="main-content col-lg-12" id="leftListDiv">
            <div class="content-wrap">
                <div class="wrapper" style="bottom: 50px;">
                    <ul class="nav nav-tabs">
                        <li class="active">
                            <a href="#"   onclick="loadDiv('mainCenterDiv','${ctx}/sys/sysOrgDict/bloodMatchList?type=${type}')">  <c:choose>
                                <c:when test="${type eq 'BLOOD_TEST_DICT'}">
                                    验血划价项目列表
                                </c:when>
                                <c:otherwise>
                                    配血划价项目列表
                                </c:otherwise>
                            </c:choose></a>
                        </li>
                    </ul>
                    <section class="panel panel-default">
                        <div class="panel-body">
                            <div class="table-responsive no-border">
                                <table id="contentTable" class="table table-bordered mg-t datatable">
                                    <thead>
                                        <tr>
                                            <th><c:choose>
                                                <c:when test="${type eq 'BLOOD_TEST_DICT'}">
                                                    验血项目
                                                </c:when>
                                                <c:otherwise>
                                                    配血方法
                                                </c:otherwise>
                                            </c:choose></th>
                                            <th>项目编码</th>
                                            <th>项目名称</th>
                                            <th>项目类别</th>
                                            <th>执行科室</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach items="${list}" var="dict">
                                        <tr>
                                            <td> ${dict.label}</td>
                                            <td> ${dict.itemCode}</td>
                                            <td> ${dict.itemName}</td>
                                            <td> ${fns:getDictLabels(dict.itemClass, 'BILL_ITEM_CLASS_DICT', '')}</td>
                                            <td> ${dict.executiveDept.deptName}</td>
                                            <td>
                                                <c:choose>
                                                    <c:when test="${dict.itemId!=null && dict.itemId!=''}">
                                                        <a href="#" onclick="showFormDiv('${dict.id}','${type}')" class="btn btn-success btn-xs">修改</a>
                                                    </c:when>
                                                    <c:otherwise>
                                                        <a href="#" onclick="showFormDiv('${dict.id}','${type}')" class="btn btn-primary btn-xs">添加</a>
                                                    </c:otherwise>
                                                </c:choose>
                                            </td>
                                        </tr>
                                    </c:forEach>

                                </table>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </section>

        <section class="main-content col-lg-4" style="display: none" id="rightFormDiv">
            <div class="content-wrap" id="rigthCenterDiv">
            </div>
        </section>
    </section>
</div>